extends layout 

block content 
  h1 #{title}: #{book.title}

  p #[strong Author: ]
    a(href=book.author.url) #{book.author.name}
  p #[strong Summary: ] #{book.summary}
  p #[strong ISBN: ] #{book.isbn}
  p #[Strong Genre: ]
    each val, index in book.genre 
      a(href=val.url) #{val.name}
      if index < book.genre.length - 1
        |,&nsbp;
  
  hr
  if bookInstances.length > 0
    p #[Strong Delete the following copies before attempting to delete this Book.]

    div(style='margin-left: 20px; margin-top: 20px')

      h4 Copies 

      each book_copy in bookInstances 
        hr
        if book_copy.status=='Available'
          p.text-success #{book_copy.status}
        else if book_copy.status=='Maintenance'
          p.text-danger #{book_copy.status}
        else
          p.text-warning #{book_copy.status}
        p #[strong Imprint:] #{book_copy.imprint}
        if book_copy.status!='Available'
          p #[strong Due back:] #{book_copy.due_back}
        p #[strong Id:]
          a(href=book_copy.url) #{book_copy._id}

  else 
    p Do you really want to delete this Book?
    
    form(method='POST')
      .form-group 
        input#id.form-control(type='hidden', name='id', value=book._id)
      
      button.btn.btn-primary(type='submit') Delete